<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
        <meta name="renderer" content="webkit">
        <title>网站信息</title>  
        <link rel="stylesheet" href="/Public/Admin/css/pintuer.css">
        <link rel="stylesheet" href="/Public/Admin/css/admin.css">
        <script src="__PUBLICHJS__/jquery-2.2.0.min.js"></script>
        <script src="/Public/Admin/js/pintuer.js"></script>  
        <script src="/Public/js/layer/layer.js"></script>
        <script src="/Public/Admin/js/jquery.js"></script>
</head>
<body>
<script>
//页面层
function save(id){
  $('#abc').val(id);
layer.open({
  type: 1,
  skin: 'layui-layer-rim', //加上边框
  area: ['420px', '240px'], //宽高
  content: '<div id="close" style="font-size:16px;padding:30px;"><center><span>设置销量：</span><input type="text" id="jifen_a"/></center></div><center><div style="font-size:12px;"><input onclick="jifen()"  type="button" class="btn btn-success" value="确定" style="margin-right:10px;padding:3px 6px;"/></div></center>'
});

}
function jifen(){
  var id = $("#abc").val();
  var jifen = $("#jifen_a").val();
  $.post("{:U('Goods/setSaleCount')}",{id:id,num:jifen},function(d){
    if(d.status==1){
      alert("操作成功");
      window.location.reload();
    }else{
      alert("参数错误，稍后再试");
    }
  })
}
</script>
<input id="abc" type="hidden">
<div class="panel admin-panel">
 <!--  <div class="panel-head"><strong class="icon-reorder"> 商品列表</strong></div> -->
 
  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 商品列表</strong> </div>
   <form method="post" action="{:U('Goods/index')}" id="listform">
    <div class="padding border-bottom">
      <ul class="search" style="padding-left:10px;">
        <!-- <li> <a class="button border-main icon-plus-square-o" href="{:U('Goods/addGoods')}"> 添加商品</a> </li> -->
      <li>
          <input type="text" placeholder="{$search|default='请输入商品名称关键字'}" name="name" class="input" value="{$search_title}" style="width:250px; line-height:17px;display:inline-block" />
          <a href="javascript:void(0)" class="button border-main icon-search" onclick="changesearch()" > 搜索</a></li>
     <!--  <li> <a class="button border-main icon-plus-square-o" href="{:U('Goods/setRule')}"> 添加活动规则</a> </li> -->
      </ul>
    </div>
    </form>
    <script>
    function changesearch(){  
    $('#listform').submit();
}
    </script>
  <div class="table-responsive">
    <table class="table table-hover text-center">
      <thead>
       <tr>
      <th >合计:</th>
      <th ></th>
      <th ></th>
      <th ></th>
      <th >{$sumnum}</th>
      <th >{$sumzlnum}</th>
      <th >{$sumzlren}</th>
      <th ></th>
    </tr>
    <tr>
      <th >序号</th>
      <th >商品名称</th>
      <th >图片</th>
      <th >是否结束</th>
      <th ><a id="pqnum" msg="<?php echo $_SESSION['pqnum']?>"  href="javascript:void(0)">被拼抢次数</a></th>
      <th ><a id="zlcs" msg="<?php echo $_SESSION['zlcs']?>"  href="javascript:void(0)">助力次数</a></th>
      <th ><a id="zlrs" msg="<?php echo $_SESSION['zlrs']?>"  href="javascript:void(0)">助力人数</a></th>
      <th >操作</th>
    </tr>
      </thead>
    <tbody>
      <volist name="list" id="vo" key='k'>
        <tr>
          
          <td>{$k}</td>
          <td>{$vo.name}</td>
          <td><img src="{$vo['image']}" style="width:50px;"></td>
          <td ><php>if($vo['end_time']< time()){echo "已结束";}else{echo "拼抢中";}</php></td>
          <td>{$vo.num}</td>
          <td>{$vo.zlnum}</td>
          <td>{$vo.zlren}</td>
          <td>
            <a href="{:U('Goods/addGoods',array('goods_id'=>$vo['goods_id']))}"  class="button border-main icon-search" >商品详情</a>
            <a href="{:U('Pingqiang/xiangqing',array('goods_id'=>$vo['goods_id']))}"  class="button border-main icon-search" >拼抢详情</a>
        </td>
        </tr>
      </volist>
       </tbody> 
    </table>
  </div>
  </div>

  <div class="pagelist"> <ul>{$page}</ul></div>
</div>
<script>

 $("#pqnum").click(function(){
  var msg=$(this).attr('msg');
  if(msg==''){
    msg='asc';
  }
  //alert(12354);
  location.href="{:U('Pingqiang/index')}?hh="+msg;
}) 
$("#zlcs").click(function(){
  var msg=$(this).attr('msg');
  if(msg==''){
    msg='asc';
  }
  //alert(12354);
  location.href="{:U('Pingqiang/index')}?zlcs="+msg;
}) 
$("#zlrs").click(function(){
  var msg=$(this).attr('msg');
  if(msg==''){
    msg='asc';
  }
  //alert(12354);
  location.href="{:U('Pingqiang/index')}?zlrs="+msg;
}) 
</script>

</body></html>
